<html lang="en" xmlns="http://www.thymeleaf.org">
<head>
    <!-- required meta tags -->
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">

    <!-- bootstrap css -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">

    <title>Save Employee</title>
</head>
<body>
    <div class="container">
        <h3>Employee Directory</h3>
        <hr>

        <p class="h4 mb-4">Save Employee</p>

        <form action="#" th:action="@{/employees/save}"
                         th:object="${employee}" method="post">

            <!-- add hidden form field to handle update -->
            <input type="hidden" th:field="*{id}" />
            <input type="text" th:field="*{firstName}"
                class="form-control mb-4 col-4" placeholder="First Name" />
            <input type="text" th:field="*{lastName}"
                class="form-control mb-4 col-4" placeholder="Last Name" />
            <input type="text" th:field="*{email}"
                class="form-control mb-4 col-4" placeholder="Email" />
            <button type="submit" class="btn btn-info col-2">Save</button>
        </form>

        <hr>
        <a th:href="@{/employees/list}">Back to Employees List</a>
    </div>
</body>
</html>